package com.google.gson.internal.bind;

import com.google.gson.ExclusionStrategy;
import com.google.gson.a.a;
import com.google.gson.b.d;
import com.google.gson.internal.bind.TypeAdapter.Factory;
import java.io.IOException;

public final class g implements Factory {
    private final ExclusionStrategy a;
    private final ExclusionStrategy b;

    public g(ExclusionStrategy exclusionStrategy, ExclusionStrategy exclusionStrategy2) {
        this.a = exclusionStrategy;
        this.b = exclusionStrategy2;
    }

    public TypeAdapter create(l lVar, a aVar) {
        Class a = aVar.a();
        final boolean shouldSkipClass = this.a.shouldSkipClass(a);
        final boolean shouldSkipClass2 = this.b.shouldSkipClass(a);
        if (!shouldSkipClass && !shouldSkipClass2) {
            return null;
        }
        final l lVar2 = lVar;
        final a aVar2 = aVar;
        return new TypeAdapter(this) {
            final /* synthetic */ g e;
            private TypeAdapter f;

            private TypeAdapter a() {
                TypeAdapter typeAdapter = this.f;
                if (typeAdapter != null) {
                    return typeAdapter;
                }
                typeAdapter = lVar2.a(this.e, aVar2);
                this.f = typeAdapter;
                return typeAdapter;
            }

            public void a(d dVar, Object obj) throws IOException {
                if (shouldSkipClass) {
                    dVar.f();
                } else {
                    a().a(dVar, obj);
                }
            }

            public Object b(com.google.gson.b.a aVar) throws IOException {
                if (!shouldSkipClass2) {
                    return a().b(aVar);
                }
                aVar.n();
                return null;
            }
        };
    }
}
